<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
      xmlns:p="http://xmlns.jcp.org/jsf/passthrough">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputLabel value="#{messages.Learningresource}"/>
        </ui:define>
        <ui:define name="body">
            <h:form styleClass="jsfcrud_list_form" enctype="multipart/form-data" id="form">
                <h:panelGrid columns="2">
                    <c:forEach begin="1" end="#{learningresourceController.numberOfnewFilePart()}" var="index">
                        <h:outputLabel value="#{index}"  dir="RTL"/>
                        <h:inputFile id="filesUpload" value="#{learningresourceController.filesPart[index]}" validator="#{learningresourceController.fileValidate}"
                                     p:placeholder="#{messages.No}#{messages.More}#{messages.Than}#{learningresourceControllerA.maxAudioSize}"
                                     />
                    </c:forEach>
                    <h:commandButton action="#{learningresourceController.createLearningResource()}" value="#{messages.Finished}"/>
                    <h:outputLabel/>
                </h:panelGrid>
                <fieldset id="audio" title="#{messages.Audio}">
                   <legend>#{messages.If} #{messages.Necessary},#{messages.Continue} #{messages.Add} #{messages.Other}</legend> 
                    <!-- 连接到在知识点中新建学习资源，包括图像、音频和视频等 -->
                    <h:panelGrid columns="1">
                        <c:forEach items="#{learningresourceControllerA.mediaMap}" var="resource">
                            <h:commandButton  action="#{learningresourceController.prepareAndUpdateLearningResource(resource.key)}" 
                                             value="#{messages.Add}#{resource.value}" rendered="#{learningresourceController.notAudio(resource)}"/>
                        </c:forEach>
                    </h:panelGrid>
                </fieldset>
            </h:form>
        </ui:define>
    </ui:composition>
</html>
